Skip to content

fix(python): handle PEP 440 direct references and path dependencies in uv export#2

Open
a-oren wants to merge 4 commits into
mainfrom
TC-4538
Open

fix(python): handle PEP 440 direct references and path dependencies in uv export#2
a-oren wants to merge 4 commits into
mainfrom
TC-4538

Conversation

@a-oren
Copy link
Copy Markdown
Owner

@a-oren a-oren commented May 21, 2026

Summary

  • Skip PEP 440 direct references (name @ url) and path dependencies (./, ../, /) in parseUvExport() with log.fine() warning instead of throwing IOException
  • Set currentKey = null after skipping to prevent # via comments from corrupting the dependency graph of other packages
  • Add test fixture with mixed direct refs and normal packages, plus 7 new unit tests covering skip behavior, graph integrity, and integration with provideStack()/provideComponent()

Implements TC-4538

Test plan

  • parseUvExport() skips PEP 440 direct references without throwing
  • parseUvExport() skips path dependencies (./, ../, /) without throwing
  • Packages following skipped lines are parsed correctly
  • # via comments after skipped packages do not corrupt the graph
  • provideStack() and provideComponent() succeed with direct refs in export output
  • Existing tests pass (27/27)
  • mvn spotless:check passes

🤖 Generated with Claude Code

…n uv export

Skip PEP 440 direct references (name @ url) and path dependencies (./,
../, /) in parseUvExport() with a log.fine() warning instead of throwing
an IOException. These lines lack pinned versions needed for the dependency
graph. Set currentKey to null after skipping to prevent # via comments
from corrupting the graph of other packages.

Implements TC-4538

Signed-off-by: Adva Oren <aoren@redhat.com>
Assisted-by: Claude Code
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

Test Results

527 tests   525 ✅  1m 10s ⏱️
 35 suites    2 💤
 35 files      0 ❌

Results for commit 7c1fa00.

♻️ This comment has been updated with latest results.

a-oren and others added 3 commits May 21, 2026 11:00
…quirements.txt (guacsec#485)

## Summary
- Adds `preprocessRequirementsLines()` to `PythonControllerBase` that
properly handles all requirements.txt line types before dependency
resolution
- Fixes parsing errors when requirements.txt contains
`--extra-index-url`, `--hash`, line continuations (`\`), and other
non-package lines
- Handles: pip options, inline options (--hash, --config-settings), line
continuations, PEP 508 direct references (`name @ url`), bare URLs, VCS
URLs, and local paths

Fixes [TC-4527](https://redhat.atlassian.net/browse/TC-4527)
Related:
fabric8-analytics/fabric8-analytics-vscode-extension#843

## Test plan
- [x] 13 unit tests covering all requirements.txt line types
- [x] Existing `getIgnoredDependencies_strips_environment_markers` test
passes
- [ ] Manual verification with requirements.txt files containing
`--extra-index-url` and line continuations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

[TC-4527]:
https://redhat.atlassian.net/browse/TC-4527?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

## Summary by Sourcery

Improve Python requirements.txt preprocessing to robustly handle pip
options, hashes, line continuations, and non-package lines before
dependency resolution.

Bug Fixes:
- Fix handling of requirements.txt entries that include pip options,
hashes, line continuations, direct references, bare URLs, VCS URLs, and
local paths so they no longer break dependency parsing and installation.

Enhancements:
- Introduce a reusable preprocessing routine for requirements.txt lines
and apply it across Python dependency resolution and ignored-dependency
detection to ensure consistent parsing behavior.

Tests:
- Add unit tests covering preprocessing of all supported
requirements.txt line variants, including pip options, hashes, line
continuations, direct references, URLs, local paths, and mixed
scenarios.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…, add ~/Windows path support

Address code review feedback:
- Extract isDirectReference() and isPathDependency() helper methods for
  clearer naming and a single place to extend edge case handling
- Add ~/home-relative and Windows drive path (C:\) detection
- Add test for # via graph corruption after skipped path dependencies

Implements TC-4538

Signed-off-by: Adva Oren <aoren@redhat.com>
Assisted-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant